package project.euler.honk.problem.to50;

final class Problem31 {

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		int count = solve();
		long end = System.currentTimeMillis();
		System.out.println("Result: " + count + " Time: " + (end - start));
	}

	private static int solve() {
		int count = 1;
		for (int hundrets = 0; hundrets <= 2; hundrets++) {
			int h_v = 100 * hundrets;
			for (int twos = 0; twos <= 100; twos++) {
				int t_v = h_v + twos * 2;
				if (t_v > 200)
					break;
				for (int fives = 0; fives <= 40; fives++) {
					int f_v = t_v + 5 * fives;
					if (f_v > 200)
						break;
					for (int tens = 0; tens <= 20; tens++) {
						int te_v = f_v + 10 * tens;
						if (te_v > 200)
							break;
						for (int twent = 0; twent <= 10; twent++) {
							int tw_v = te_v + 20 * twent;
							if (tw_v > 200)
								break;
							for (int fifties = 0; fifties <= 4; fifties++) {
								int fi_v = tw_v + fifties * 50;
								if (fi_v > 200)
									break;
								for (int ones = 0; ones <= 200; ones++) {
									int value = fi_v + ones;
									if (value > 200)
										break;
									else if (value == 200) {
										count++;
										break;
									}

								}
							}
						}
					}
				}
			}
		}
		return count;
	}

}
